<?php
namespace app\Admin\model;

use think\Db;
use think\Model;

class Nav extends Model
{
	public function get_NavCatList($where = '')
	{
		return Db::name('nav_cat')->where($where)->select();
	}

	public function get_NavCatAdd($data)
	{
		return Db::table('tp_nav_cat')->insert($data);
	}

	public function get_NavCatOne($id)
	{
		return Db::name('nav_cat')->where(array('id'=>$id))->find();
	}

	public function get_NavCatEdit($data, $id)
	{
		return Db::table('tp_nav_cat')->where(array('id'=>$id))->update($data);
	}

	public function get_NavCatDel($id)
	{
		return Db::table('tp_nav_cat')->where(array('id'=>$id))->delete();
	}

	public function get_NavList($where = '')
	{
		return Db::name('nav')->where($where)->select();
	}

	public function get_NavOne($id)
	{
		return Db::name('nav')->where(array('id'=>$id))->find();
	}

	public function get_NavAdd($data)
	{
		return Db::table('tp_nav')->insert($data);
	}

	public function get_NavEdit($data, $id)
	{
		return Db::table('tp_nav')->where(array('id'=>$id))->update($data);
	}

	public function get_NavDel($id)
	{
		return Db::table('tp_nav')->where(array('id'=>$id))->delete();
	}

	public function getNavCatListTop()
	{
		return Db::name('nav_cat')->where(array('site'=>1))->select();
	}
}